/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.inspur.edp.cef.generator.coreGenerator.base;

import com.inspur.edp.caf.generator.compileunit.CompileUnitGeneratorContext;
import com.inspur.edp.cef.entity.config.CefConfig;
import com.inspur.edp.cef.gencommon.MediateType;
import com.inspur.edp.cef.generator.coreGenerator.base.entitygen.EntityGeneratorContext;
import com.inspur.edp.cef.generator.overall.CefGeneratorContext;
import com.inspur.edp.cef.generator.repository.common.IntermediateType;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public abstract class CefCoreGeneratorContext extends CompileUnitGeneratorContext {

  private CefGeneratorContext cefGenContext;

  public EntityGeneratorContext getEntityGeneratorContext() {
    return entityGeneratorContext;
  }

  public void setEntityGeneratorContext(EntityGeneratorContext entityGeneratorContext) {
    this.entityGeneratorContext = entityGeneratorContext;
  }

  private EntityGeneratorContext entityGeneratorContext;

  protected CefCoreGeneratorContext(CefGeneratorContext cefGenContext) {
    this.cefGenContext = cefGenContext;
    privateEntityImplTypes = new java.util.HashMap<String, MediateType>();
  }

  public CefGeneratorContext getCefGenContext() {
    return cefGenContext;
  }

  private String privateNamespace;

  public final String getNameSpace() {
    return privateNamespace;
  }

  public final void setNamespace(String value) {
    privateNamespace = value;
  }

  private String privateAssemblyName;

  public final String getAssemblyName() {
    return privateAssemblyName;
  }

  public final void setAssemblyName(String value) {
    privateAssemblyName = value;
  }

  @Override
  public String getPackageName() {
    return getNameSpace();
  }
  // core的程序集加载存在问题, core引用的api会优先加载运行目录下的
  // 运行目录下的与生成目录的如果接口不一致导致core的assembly加载不起来
  // public Assembly Assembly { get; internal set; }

  private MediateType privateMgrImplType;

  public final MediateType getMgrImplType() {
    return privateMgrImplType;
  }

  public final void setMgrImplType(MediateType value) {
    privateMgrImplType = value;
  }

  private MediateType privateRootEntityImplType;

  public final MediateType getRootEntityImplType() {
    return privateRootEntityImplType;
  }

  public final void setRootEntityImplType(MediateType value) {
    privateRootEntityImplType = value;
  }

  private java.util.HashMap<String, MediateType> privateEntityImplTypes;

  public final java.util.HashMap<String, MediateType> getEntityImplTypes() {
    return privateEntityImplTypes;
  }

  private MediateType privateChangeSerializerType;

  public final MediateType getChangeSerializerType() {
    return privateChangeSerializerType;
  }

  public final void setChangeSerializerType(MediateType value) {
    privateChangeSerializerType = value;
  }

  private java.util.HashMap<String, MediateType> privateChildChangeSerializerType =
      new java.util.HashMap<String, MediateType>();

  public final java.util.HashMap<String, MediateType> getChildChangeSerializerType() {
    return privateChildChangeSerializerType;
  }

  private Map<String, List<MediateType>> childExtSerItemTypes = new HashMap<>();

  public List<MediateType> getChildExtendSerItemTypes(String nodeCode) {
    return childExtSerItemTypes.get(nodeCode);
  }

  public void addChildExtendSerItemTypes(String nodeCode, MediateType... type) {
    List<MediateType> child = childExtSerItemTypes.get(nodeCode);
    if (child == null) {
      child = new ArrayList<>();
      childExtSerItemTypes.put(nodeCode, child);
    }
  }

  private MediateType configClassType;

  public MediateType getConfigClassType() {
    return configClassType;
  }

  public void setConfigClassType(MediateType value) {
    configClassType = value;
  }

  private CefConfig config;

  public CefConfig getConfig() {
    return config;
  }

  public void setConfig(CefConfig value) {
    config = value;
  }

  /**
   * 是否开启国际化时区，vo中复写
   *
   * @return
   */
  public Boolean getEnableStdDateTime() {
    return false;
  }

  private HashMap<String, MediateType> entityMediateTypes = new HashMap<>();

  public final HashMap<String, MediateType> getEntityMediateTypes() {
    return entityMediateTypes;
  }


  private MediateType accessorCreatorType;

  public MediateType getAccessorCreatorType() {
    return accessorCreatorType;
  }

  public void setAccessorCreatorType(MediateType accessorCreatorType) {
    this.accessorCreatorType = accessorCreatorType;
  }


  private java.util.HashMap<String, MediateType> privateEntityDataMediateTypes = new java.util.HashMap<String, MediateType>();

  public final java.util.HashMap<String, MediateType> getEntityDataMediateTypes() {
    return privateEntityDataMediateTypes;
  }

  private boolean useDualAcc;
  public boolean getUseDualAcc() {
    return useDualAcc;
  }
  
  public void setUseDualAcc(boolean value) {
    useDualAcc = value;
  }

  private java.util.HashMap<String, MediateType> accessorMediateTypes = new java.util.HashMap<String, MediateType>();

  public final java.util.HashMap<String, MediateType> getAccessorMediateTypes() {
    return accessorMediateTypes;
  }

  private java.util.HashMap<String, MediateType> privateReadonlyAccessorMediateTypes = new java.util.HashMap<String, MediateType>();

  public final java.util.HashMap<String, MediateType> getReadonlyAccessorMediateTypes() {
    return privateReadonlyAccessorMediateTypes;
  }

  private MediateType repositoryType;

  public MediateType getRepositoryType() {
    return repositoryType;
  }

  public abstract String getVersionControlPropertyName();

  private Class privateEntityRepositoryFactory;
  private Class privateNestedRepositoryFactory;
  private Class privateNestedManagerFactory;
  public final Class entityRepositoryFactory() {
    return this.privateEntityRepositoryFactory;
  }
  public final Class nestedRepositoryFactory() {
    return this.privateNestedRepositoryFactory;
  }

  public final Class nestedManagerFactory() {
    return this.privateNestedManagerFactory;
  }
  public final void setRepositoryType(MediateType value) {
    this.repositoryType = value;
  }
}
